package com.siteseat.common.entity;

/**
 *
 */
public enum ValueType {

  INTEGER( "integer" ), FLOAT( "float" ), BYTES( "bytes" ), TEXT( "text" );

  private String label;

  private ValueType( String label ) {
    this.label = label;
  }

  public static String format( ValueType type ) {
    return type.label;
  }

  public String label() {
    return this.label;
  }

  public static ValueType parse( String typeText ) {
    if( INTEGER.label.equals( typeText ) ) {
      return INTEGER;
    }
    if( FLOAT.label.equals( typeText ) ) {
      return FLOAT;
    }
    if( BYTES.label.equals( typeText ) ) {
      return BYTES;
    }
    if( TEXT.label.equals( typeText ) ) {
      return TEXT;
    }
    return TEXT;
  }

}
